<?php

/**
 * main.php
 *
 * This file holds frontend configuration settings.
 *
 * @author: antonio ramirez <antonio@clevertech.biz>
 * Date: 7/22/12
 * Time: 5:48 PM
 */
$frontendConfigDir = dirname(__FILE__);

$root = $frontendConfigDir . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..';

$params = require_once($frontendConfigDir . DIRECTORY_SEPARATOR . 'params.php');

// Setup some default path aliases. These alias may vary from projects.
Yii::setPathOfAlias('root', $root);
Yii::setPathOfAlias('common', $root . DIRECTORY_SEPARATOR . 'common');
Yii::setPathOfAlias('frontend', $root . DIRECTORY_SEPARATOR . 'frontend');
Yii::setPathOfAlias('www', $root . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'www');

$mainLocalFile = $frontendConfigDir . DIRECTORY_SEPARATOR . 'main-local.php';
$mainLocalConfiguration = file_exists($mainLocalFile) ? require($mainLocalFile) : array();

$mainEnvFile = $frontendConfigDir . DIRECTORY_SEPARATOR . 'main-env.php';
$mainEnvConfiguration = file_exists($mainEnvFile) ? require($mainEnvFile) : array();

return CMap::mergeArray(
                array(
            'name' => 'Courses & Workshops | Professional & Recreational Skills | Delhi Gurgaon Noida',
            // @see http://www.yiiframework.com/doc/api/1.1/CApplication#basePath-detail
            'basePath' => 'frontend',
            // set parameters
            'params' => $params,
            // preload components required before running applications
// @see http://www.yiiframework.com/doc/api/1.1/CModule#preload-detail
//  'preload' => array('bootstrap', 'log'),
// @see http://www.yiiframework.com/doc/api/1.1/CApplication#language-detail
            'language' => 'en',
            // uncomment if a theme is used
            'theme' => 'front-end',
            //
            'behaviors' => array('ApplicationConfigBehavior'),
            // setup import paths aliases
// @see http://www.yiiframework.com/doc/api/1.1/YiiBase#import-detail
            'import' => array(
                'common.extensions.yii-mail.YiiMailMessage',
                'common.components.*',
                'common.extensions.*',
                'common.models.*',
                'common.lib.*',
                'common.extensions.giix-components.*', // giix components
                'application.components.*',
                'application.components.shoppingCart.*',
                'application.controllers.*',
                'application.modules.hybridauth.controllers.*',
                'application.models.*',
                'application.modules.cms.CmsModule',
                'common.extensions.PHPMailer.SkillSendMail',
            ),
            'aliases' => array(
                'xupload' => 'application.extensions.xupload'
            ),
            /* uncomment and set if required */
// @see http://www.yiiframework.com/doc/api/1.1/CModule#setModules-detail
            'modules' => array(
                'cms',
// uncomment the following to enable the Gii tool
                'gii' => array(
                    'class' => 'system.gii.GiiModule',
                    'password' => 'admin',
                    'generatorPaths' => array(
                        'common.extensions.giix-core', // giix generators
                    ),
                    // If removed, Gii defaults to localhost only. Edit carefully to taste.
                    'ipFilters' => array('127.0.0.1', '::1'),
                ),
                'user' => array(
                    'modules' => array(
                        'role',
                        'profiles',
                        'messages',
                    ),
                    'debug' => 'true',
                ),
                'hybridauth' => array(
                    'baseUrl' => 'http://' . $_SERVER['SERVER_NAME'] . '/skilldevelopers/frontend/www/index.php/hybridauth',
                    'withYiiUser' => false, // Set to true if using yii-user
                    "providers" => array(
                        "openid" => array(
                            "enabled" => true
                        ),
                        "yahoo" => array(
                            "enabled" => true
                        ),
                        "google" => array(
                            "enabled" => true,
                            "keys" => array("id" => "", "secret" => ""),
                            "scope" => ""
                        ),
                        "facebook" => array(
                            "enabled" => true,
                            "keys" => array("id" => "", "secret" => ""),
                            "scope" => "email,publish_stream",
                            "display" => ""
                        ),
                        "twitter" => array(
                            "enabled" => true,
                            "keys" => array("key" => "", "secret" => "")
                        )
                    )
                ),
            ),
            'components' => array(
                'shoppingCart' => array('class' => 'application.components.shoppingCart.EShoppingCart',),
                'request' => array(
                    'class' => 'application.components.HttpRequest',
                    'enableCsrfValidation' => true,
                    'enableCookieValidation' => true,
                    'noCsrfValidationRoutes' => array(
                        'users/uploadphoto', 'classImage/deleteClassImage'
                    ),
                ),
                'cms' => array(
                    'class' => 'cms.components.Cms',
                    'users' => array('admin@skillhippo.com'),
                    'languages' => array('en_us' => 'English'),
                    'defaultLanguage' => 'en_us',
                    'allowedFileTypes' => 'jpg, gif, png',
                    'allowedFileSize' => 1024,
                    'headingTemplate' => '<h1 class="heading">{heading}</h1>',
                    'widgetHeadingTemplate' => '<h3 class="heading">{heading}</h3>',
                    'pageTitleTemplate' => '{title} | {appName}',
                    'appLayout' => 'www.themes.front-end.views.layouts.main',
                    'flashError' => 'error',
                    'flashInfo' => 'info',
                    'flashSuccess' => 'success',
                    'flashWarning' => 'warning',
                ),
                'mail' => array(
                    'class' => 'common.extensions.yii-mail.YiiMail',
                    'transportType' => 'smtp',
                    'transportOptions' => array(
                        'host' => 'smtp.gmail.com',
                        'username' => 'your_gmail_id',
                        'password' => 'your_gmail_password',
                        'port' => '465',
                        'encryption' => 'ssl',
                    ),
                    'viewPath' => 'application.views.mail',
                    'logging' => true,
                    'dryRun' => false
                ),
                'errorHandler' => array(
// @see http://www.yiiframework.com/doc/api/1.1/CErrorHandler#errorAction-detail
                    'errorAction' => 'site/error'
                ),
                'db' => array(
                    'connectionString' => $params['db.connectionString'],
                    'username' => $params['db.username'],
                    'password' => $params['db.password'],
                    'schemaCachingDuration' => YII_DEBUG ? 0 : 86400000, // 1000 days
                    'enableParamLogging' => YII_DEBUG,
                    'charset' => 'utf8',
                    'tablePrefix' => 'skill_',
                ),
                'urlManager' => array(
                    'urlFormat' => 'path',
                    'showScriptName' => false,
                    'urlSuffix' => '/',
                    'rules' => $params['url.rules']
                ),
//                'user' => array(
//                    'class' => 'application.modules.user.components.WebUser',
//                    // enable cookie-based authentication
//                    'allowAutoLogin' => true,
//                    'loginUrl' => array('/user/user/login'),
//                ),
                'image' => array(
                    'class' => 'common.extensions.image.CImageComponent',
                    'driver' => 'GD',
                ),
            /* make sure you have your cache set correctly before uncommenting */
            /* 'cache' => $params['cache.core'], */
            /* 'contentCache' => $params['cache.content'] */
            ),
                ), CMap::mergeArray($mainEnvConfiguration, $mainLocalConfiguration)
);
